<%--
    Document   : login
    Created on : 14 avr. 2011, 19:54:29
    Author     : Remi HEENS
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="include/header.jsp" %>

<div id="main">
    <div id="container">
        <div id="content">
            <div id="registerDiv">
                <form id="registerForm" name="registerForm" method="post" action="RegisterServlet">
                    <input type="hidden" name="action" value="register"/>
                    <label class="form-label">Login</label> <input name="login" id="login" type="text" class="required" size="25" />
                    <label class="form-label">Password</label> <input name="pwd" id="pwd" type="password" class="required" size="25" />
                    <label class="form-label">Re-type</label> <input name="pwd2" type="password" class="required" size="25" />
                    <label class="form-label">Email</label> <input name="mail" type="text" class="required email" size="25" />
                    <br/><br/>
                    <input name="inscription" type="submit" value="Inscription" />
                </form>
            </div>
            <script type="text/javascript">
                $("#login").keyup(function() {
                    $.get("./LoginServlet?action=existLogin&login="+$("#login").val(),
                        function(data){
                            if(data["exist"] == "true")
                            {
                                $("#login").removeClass("valid");
                                $("#login").addClass("error");
                            }
                            else
                            {
                                $("#login").removeClass("error");
                                $("#login").addClass("valid");
                            }
                        },
                        "json"
                    );
                });
                $("#login").blur(function(){
                    var t = $("#login").val();
                    if(t == "")
                    {
                        $("#login").removeClass("valid");
                        $("#login").addClass("error");
                    }
                });
            </script>
        </div><!-- #content -->
    </div><!-- #container -->
</div><!-- #main -->
<%@ include file="include/footer.jsp" %>